<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">

        <div><?php include "../public_flow/flow_show_info.php";?></div>

        <div class="table-box tablenes">
            <div class="title">基本信息</div>
            <table class="layui-table">
                <tbody>

                <tr><td class="tt">工程名称</td><td id="enginname" class="colorlan tv" colspan="3"></td></tr>
                <tr><td class="tt">业务归属</td><td id="gui_unit_name" class="tv"></td><td class="tt">资质要求</td><td id="gongzi" class="tv"></td></tr>
                <tr><td class="tt">工程负责人</td><td id="gofuer" class="tv"></td><td class="tt">联系电话</td><td id="gofutel" class="tv"></td></tr>

                <tr><td class="tt">合同名称</td><td id="name" class="tv"></td><td class="tt">合同编号</td><td id="number" class="tv"></td></tr>
                <tr><td class="tt">合同年份</td><td id="year" class="tv"></td><td class="tt">合同类型</td><td id="shihetype" class="tv"></td></tr>
                <tr><td class="tt">发包人(甲方)</td><td id="faer" class="tv"></td><td class="tt">承包人(乙方)</td><td id="chenger_name" class="tv"></td></tr>
                <tr><td class="tt">合同价(元)</td><td id="money" class="tv"></td><td class="tt">税率(%)</td><td id="rate" class="tv"></td></tr>
                <tr><td class="tt">开工日期</td><td id="startdt" class="tv"></td><td class="tt">竣工日期</td><td id="enddt" class="tv"></td></tr>
                <tr><td class="tt">质保金比例(%)</td><td id="zhirate" class="tv"></td><td class="tt">质保金金额(元)</td><td id="zhifee" class="tv"></td></tr>
                <tr><td class="tt">质保期(月)</td><td id="zhibao" class="tv"></td><td class="tt">质保金预计回款日期</td><td id="huidt" class="tv"></td></tr>
                <tr><td class="tt">合同状态</td><td id="state_name" class="tv"></td><td class="tt">合同份数</td><td id="henum" class="tv"></td></tr>
                <tr><td class="tt">签订日期</td><td id="qiandt" class="tv" colspan="3"></td></tr>
                <tr><td class="tt">合同主要条款</td><td class="tv" id="clause" colspan="3"></td></tr>
                <tr><td class="tt">合同风险分析</td><td class="tv" id="xianfen" colspan="3"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo">补充合同</script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo_gong">工程量清单</script>
            <div class="tableShow">
                <table id="datalist_gong" lay-filter="datalist_gong"></table>
            </div>
        </div>

        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_isdan = getQueryVariable('isdan') || 0;
    if(param_isdan > 0){
        $("#page-close").remove();
    }
    var param_id = getQueryVariable('id') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_contract_shi_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;

                if(engininfo){
                    $("#enginname").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });
                    $('#gui_unit_name').text(engininfo.gui_unit_name);
                    $('#gongzi').text(engininfo.gongzi);
                    $('#gofuer').text(engininfo.gofuer);
                    $('#gofutel').text(engininfo.gofutel);
                }



                $("#name").text(data.name);
                $("#number").text(data.number);
                $("#shihetype").text(data.shihetype);
                $("#year").text(data.year);
                $("#faer").text(data.faer);
                $("#chenger_name").text(data.chenger_name);
                $("#money").text(parseFormatNum(data.money));
                $("#rate").text(data.rate);
                $("#startdt").text(data.startdt);
                $("#enddt").text(data.enddt);
                $("#state_name").text(data.state_name);
                $("#myer").text(data.myer);
                $("#henum").text(data.henum);
                $("#qiandt").text(data.qiandt);
                $("#zhirate").text(data.zhirate);
                $("#zhifee").text(parseFormatNum(data.zhifee));
                $("#zhibao").text(data.zhibao);
                $("#huidt").text(data.huidt);
                $("#zhinum").text(data.zhinum);
                $("#zhidt").text(data.zhidt);
                $("#clause").text(data.clause);
                $("#xianfen").text(data.xianfen);
                $("#explain").text(data.explain);

                var mytableList = table.render({
                    elem: "#datalist",data:res.data.list, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号'}
                        ,{field:'',title:'流程状态',templet: function(d){
                                if(d.billid > 0){
                                    if(d.status == 0){
                                        return '<span class="list_billid colorlan" onclick="openPage(\'../contract_bu/show.php?id='+d.id+'\');">流程(审批中)</span>'
                                    }else if(d.status == 1){
                                        return '<span class="list_billid colorlan" onclick="openPage(\'../contract_bu/show.php?id='+d.id+'\');">流程(审批通过)</span>'
                                    }else{
                                        return '';
                                    }
                                }else{
                                    return '<td>手动</td>';
                                }
                            }}
                        ,{field:'',title:'补充合同名称',templet: function(d){
                                return '<span class="colorlan" onclick="show_contractbu('+d.id+')">'+d.name+'</span>';
                            }}
                        ,{field: 'number', title: '合同编号'}
                        ,{field:'money',title:'合同金额(元)',templet: function(d){
                                return parseFormatNum(d.money);
                            }}
                        ,{field: 'qianer', title: '签订人'}
                        ,{field: 'qiandt', title: '签订日期'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });

                var mytableList22 = table.render({
                    elem: "#datalist_gong",data:res.data.gong, toolbar: '#toolbarDemo_gong', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号'}
                        ,{field: 'num', title: '清单编号'}
                        ,{field: 'name', title: '分部名称'}
                        ,{field: 'xiang', title: '分项名称'}
                        ,{field: 'unit', title: '单位'}
                        ,{field: 'bulk', title: '工程量'}
                        ,{field:'price',title:'综合单价(元)',templet: function(d){
                                return parseFormatNum(d.price);
                            }}
                        ,{field:'heprice',title:'合价(元)',templet: function(d){
                                return parseFormatNum(d.heprice);
                            }}
                        ,{field: 'explain', title: '备注'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });


                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('contract_shi', param_id);
    });

    function show_contractbu(id) {
        openPage('../contract_bu/show.php?id='+id);
    }







</script>
</body>
</html>




